package cn.ld.module.infra.dal.mapper.demo.demo01;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageInVO;
import cn.ld.module.infra.dal.entity.demo.demo01.Demo01ContactEntity;
import org.apache.ibatis.annotations.Mapper;

/**
 * 示例联系人 Mapper
 *
 * @author 蓝盾
 */
@Mapper
public interface Demo01ContactMapper extends BaseMapperX<Demo01ContactEntity> {

    default PageResult<Demo01ContactEntity> selectPage(Demo01ContactPageInVO inVO) {
        return selectPage(inVO, new LambdaQueryWrapperX<Demo01ContactEntity>()
                .likeIfPresent(Demo01ContactEntity::getName, inVO.getName())
                .eqIfPresent(Demo01ContactEntity::getSex, inVO.getSex())
                .betweenIfPresent(Demo01ContactEntity::getCreateTime, inVO.getCreateTime())
                .orderByDesc(Demo01ContactEntity::getId));
    }

}